-module(app).

-behaviour(application).

-export([start/2, stop/1]).

-include("common.hrl").


start(_StartType, _StartArgs) ->
    ?ECHO("开始启动应用...~n"),
    case init:get_plain_arguments() of
        [SupRoot, DirVar | T] ->
            error_logger:logfile({open, lists:concat([DirVar, "sys.log"])}),
            sys_code:init(),

            Mod = list_to_atom("sup_" ++ SupRoot),
            Mod:start_link([DirVar | T]);
        _ -> {error, args_error}
    end.

stop(_State) ->
    ok.
